home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93a.txt
/
000106_icon-group-sender _Fri Apr 9 05:14:18 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-04-21
|
2KB
Received: by cheltenham.cs.arizona.edu; Fri, 9 Apr 1993 05:53:46 MST
Via: uk.ac.manchester.computer-science; Fri, 9 Apr 1993 13:10:31 +0100
From: Steve Holden <steve@dtc.co.uk>
Date: Fri, 9 Apr 93 13:05:20 BST
Message-Id: <5718.9304091205@desktop.desktop.co.uk>
To: icon-group@cs.arizona.edu
Subject: Re: Earn guru status - help an Icon rookie
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Well, I wouldn't put myself down as a guru, but it seems to me that
a way to recast the given procedure, which was:
>
> procedure genchar( s, c )
> every i := ( s ? upto( c ) ) do
> write ( i )
> end
>
is as follows. Note that the right-hand operand of the matching
operation is now a control structure, so the &pos keyword moves
forward through the subject string. The cset() call is not strictly
necessary, as an implicit conversion would take place if a string
argument were used.
procedure main(arg)
genchar(arg[1],cset(arg[2]))
end
procedure genchar(s,c)
s ? { every i := tab(upto(c)) do
write(move(1))
}
end
This seems to work fine, as evinced by:
scotia% ./t "scotia electronic publishing" "aeiou"
o
i
a
e
e
o
i
u
i
i
Does anyone have a neater solution - this was just a quick hack.
regards
Steve
PS I hope the group would agree it exists to answer questions like this
and help converts to the Icon language?
+---------------------------------+-------------------------------------+
| Steve Holden, Technical Director| Desktop Connection Limited |
| steve@desktop.co.uk | Manchester Science Park |
|---------------------------------+ Lloyd Street North |
| Publish and be damned. Publish | Manchester England M15 4EN |
| electronically and be heard. | Tel: +44 61 227 9055 Fax: 226 4922 |
+---------------------------------+-------------------------------------+